/*
 * @# AppPropReader.java 2011-6-30 下午04:25:37
 * 
 * Copyright (C) 2010 - 2011 广州羿安信息科技有限公司
 * Guangzhou ianswer information technology co. ltd.
 * 
 * All rights reserved!
 */
package com.ianswer.px.utils;

import org.apache.commons.lang.StringUtils;

/**
 * application.properties属性配置文件读取类
 * 
 * @author tianqingsen
 */
public final class AppPropReader {

	/**
	 * application.properties 配置文件路径: classpath:/application.properties
	 */
	private static final String FILE_PATH = "classpath:/application.properties";

	public static String getProperties(String key) {
		try {
			return ConfigReader.getInstance(FILE_PATH).getContent(key);
		} catch (Exception e) {
			throw new RuntimeException("配置文件读取失败!", e);
		}
	}

	public static String getPhotoSavePath() {
		String userDir = System.getProperty("user.dir");
		return StringUtils.replace(getProperties("photo.save.path"), "${user.dir}", userDir);
	}
	
	private AppPropReader() {
		//empty!
	}
}
